package com.easyweb.entity;

// Generated May 29, 2009 4:16:57 PM by Hibernate Tools 3.2.4.GA

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
@Entity
@NamedQueries( {
	@NamedQuery(name = "ilcelerTumKayitlarIleGore", query = "select i from Ilce i where i.iller.id=:p1 order by i.ilceAdi") 
})
@Table 
public class Ilce implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Long id;
	@Version
	@Column(name = "version")
	private Integer version;
	
	@Column(name = "ilceAdi", nullable = false, length = 50)
	@NotNull(message="#{messages.errBosOlamaz}")
	@Length(max = 50,message="#{messages.errUzunlukElliGecemez}")
	private String ilceAdi;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="iIId")
	private Iller iller;

	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "ilce")
	private List<Semtler> semtlers;
	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "ilce")
	private List<Bayi> bayilers;
 	
	public Ilce() {
	}
	

	public Ilce(String ilceAdi, Iller iller, List<Semtler> semtlers) {
		super();
		this.ilceAdi = ilceAdi;
		this.iller = iller;
		this.semtlers = semtlers;
	}


	public Ilce(String ilceAdi) {
		this.ilceAdi = ilceAdi;
	}
 
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	
	public String getIlceAdi() {
		return this.ilceAdi;
	}

	public void setIlceAdi(String ilceAdi) {
		this.ilceAdi = ilceAdi;
	}

 

	public Iller getIller() {
		return iller;
	}

	public void setIller(Iller iller) {
		this.iller = iller;
	}

	public List<Semtler> getSemtlers() {
		return semtlers;
	}

	public void setSemtlers(List<Semtler> semtlers) {
		this.semtlers = semtlers;
	}


	public List<Bayi> getBayilers() {
		return bayilers;
	}


	public void setBayilers(List<Bayi> bayilers) {
		this.bayilers = bayilers;
	}

}
